package cn.tedu.tmall.front.mall.dao.repository.impl;

import cn.tedu.tmall.front.mall.dao.mapper.UserAddressMapper;
import cn.tedu.tmall.front.mall.dao.repository.IUserAddressRepository;
import cn.tedu.tmall.front.mall.pojo.po.UserAddressPO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class UserAddressRepository implements IUserAddressRepository {
    @Autowired
    private UserAddressMapper userAddressMapper;

    @Override
    public UserAddressPO getAddressByUserIdAndAddressId(Long userId, Integer addressId) {
        QueryWrapper<UserAddressPO> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        queryWrapper.eq("id", addressId);
        return userAddressMapper.selectOne(queryWrapper);
    }
}
